<template>
    <view class="content">
        <!-- 拼团优惠列表 -->
        <marketingTow
            ref="marketingTow"
            :page_i="page_i"
            @getDetailsList="getDetailsList"
            @addDara="addDara"
        ></marketingTow>

        <!-- 拼团详情列表 -->
        <marketingThree
            ref="marketingThree"
            v-show="page_i == 1"
            @getDetailsData="getDetailsData"
        ></marketingThree>

        <!-- 拼团详情 -->
        <marketingDetails
            ref="marketingDetails"
            v-show="page_i == 2"
            @backFun="backFun"
        ></marketingDetails>

        <!-- 新建活动 -->
        <marketingAdd
            ref="marketingAdd"
            v-show="page_i == 3"
            @backFun="backFun"
        ></marketingAdd>
    </view>
</template>

<script>
import marketingTow from "../../components/marketing-dough/marketingTow.vue";
import marketingThree from "../../components/marketing-dough/marketingThree.vue";
import marketingDetails from "../../components/marketing-dough/marketingDetails.vue";
import marketingAdd from "../../components/marketing-dough/marketingAdd.vue";

import staticConst from "../../js/const/StaticConst.js";


export default {
    components: {
        marketingTow,
        marketingThree,
        marketingDetails,
        marketingAdd,
    },
    data() {
        return {
            curPage: staticConst.YX_PT,
            curIndex: 1, //1,
            actType: 0, // 0:新增产品 1：编辑产品
            isNotData: false, // 没有数据
            isClickUpDownBtn: false,
            page_i: 3,
        };
    },
    onLoad() {
	},

    onShow() {
        this.addEvent();
    },

    onHide() {
        this.removeEvent();
    },

    onUnload() {
        this.removeEvent();
    },

    onReady() {
        this.$refs.marketingTow.initData();
    },

    methods: {
        getDetailsList(item) {
            return;
            this.backFun(1);
            this.$refs.marketingThree.initData(item);
        },
        getDetailsData(item) {
            this.backFun(2);
            this.$refs.marketingDetails.initData(item);
        },
        addDara() {
            this.backFun(3);
            this.$refs.marketingAdd.initData();
        },
        backFun(i) {
            if (this.page_i == 3) {
                this.$confirm(
                    "您还有尚未编辑完成的活动, 离开后将不再保存",
                    "提示",
                    {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    }
                )
                    .then(() => {
                        this.page_i = i;
                    })
                    .catch(() => {});
            } else {
                this.page_i = i;
            }
        },
        /****显示上传产品列表窗口****/
        showUploadGdsWin() {
            // this.$refs.uploadGoodsFile.show("show");
        },

        /*****显示上传下载菜单****/
        upDownClick() {
            this.isClickUpDownBtn = true;
            this.$refs.upAndDownLoadMenu.show();
        },

        removeEvent() {},

        addEvent() {},
    },
};
</script>
<style lang="scss">
.content {
    display: flex;
    justify-content: flex-start;
    min-width: 820px;
    height: 100%;
    position: relative;
}
</style>